package com.glasses.primework;

import java.util.LinkedHashMap;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import org.primefaces.model.chart.DonutChartModel;

@ManagedBean
public class DonutBean {
    private final DonutChartModel model;
    
    public DonutBean() {
        model = new DonutChartModel();
        
        Map<String, Number> circle1 = new LinkedHashMap<>();
        circle1.put("Brand 1", 150);
        circle1.put("Brand 2", 400);
        circle1.put("Brand 3", 200);
        circle1.put("Brand 4", 10);
        model.addCircle(circle1);
        
        Map<String, Number> circle2 = new LinkedHashMap<>();
        circle2.put("Brand 1", 540);
        circle2.put("Brand 2", 125);
        circle2.put("Brand 3", 702);
        circle2.put("Brand 4", 421);
        model.addCircle(circle2);
        
        Map<String, Number> circle3 = new LinkedHashMap<>();
        circle3.put("Brand 1", 40);
        circle3.put("Brand 2", 325);
        circle3.put("Brand 3", 402);
        circle3.put("Brand 4", 421);
        model.addCircle(circle3);
        
        model.setTitle("Donut Chart");
        model.setLegendPosition("w");
        
        model.setTitle("Custom Options");
        model.setLegendPosition("e");
        model.setSliceMargin(5);
        model.setShowDataLabels(true);
        model.setDataFormat("value");
        model.setShadow(false);
    }
    
    public DonutChartModel getModel() {
        return model;
    }
}